<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>三角形</title>
    <script>
        for (var i = 1; i <= 7; i++) {
            for (var j = 0; j <= 7 - i; j++) {
                document.write("&nbsp;&nbsp;&nbsp;");
            }
            for (var a = 0; a < i; a++) {
                document.write(a + "&nbsp;");
            }
            for (var b = 1; b < i; b++) {
                document.write(i - b - 1 + "&nbsp;");
            }
            document.write("<br>");

        }
    </script>

</head>

<body>

</body>

</html>